Repository navigation
Conversation
sjalloq
requested review from
bacongobbler,
davidfestal,
flavio and
thomastaylor312
as code owners
November 12, 2026 08:10
A registry may ignore the `artifactType` filter of the referrers API. It reports a filter that it applied in the `OCI-Filters-Applied` header. `pull_referrers` does not read the header and does not filter the response, so the caller gets every referrer. The first two tests describe the expected behaviour. They are ignored because they fail until the fix in the next commit. The other two tests pass already: they show that the response of a registry which reports the filter is returned as it is. Refs: oras-project#318 Signed-off-by: Shareef Jalloq <shareef@jalloq.co.uk>
A registry may ignore the `artifactType` filter of the referrers API. It reports a filter that it applied in the `OCI-Filters-Applied` header. `pull_referrers` did not read the header and did not filter the response, so the caller got every referrer from such a registry. `pull_referrers` now filters the response itself, unless the registry reports that it applied the filter. This follows `referrersPageByAPI` in oras-go: the report is read from the header, or from the index annotation `org.opencontainers.referrers.filtersApplied` that version 1.1.0-rc1 of the distribution specification used. An entry of the list must be equal to `artifactType`. Fixes: oras-project#318 Signed-off-by: Shareef Jalloq <shareef@jalloq.co.uk>
sjalloq
force-pushed
the
fix/referrers-filters-applied
branch
from
November 28, 2026 08:40
35af0d4 to
a61f302
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #318.
What changes
When
pull_referrersis given an artifact type and the registry supports the referrers API, the client now filters the response itself unless the registry reports that it applied the filter. Before, it returned whatever the registry sent, so a registry that ignoresartifactTypereturned referrers of every type.The registry's report is read from two places:
OCI-Filters-Appliedresponse header. The value is a comma-separated list, and an entry must equalartifactTypeexactly.org.opencontainers.referrers.filtersApplied. Version 1.1.0-rc1 of the spec used it before the header existed.There is no public API change.
Why it is done this way
referrersPageByAPIandisReferrersFilterApplied. That is where the annotation and the exact matching come from.How behaviour differs from
mainTwo differences from oras-go remain:
Linkheader and filters each page;pull_referrersreads one page only. That iscatalogreturns only the first page of repositories because it drops theLinkheader #319.Some("")still filters, as the fallback path already does.Tests
The first commit adds four tests in
tests/referrers_filters_applied.rs, against a fake registry that never filters. Two fail onmainand are ignored: the registry reports nothing, and the registry reports a different filter. Two pass and guard that the header and the annotation are trusted. The second commit is the fix and enables the ignored tests.To see the failures:
cargo test --test referrers_filters_applied -- --include-ignoredon the first commit.